x11: Call gdk_display_sync() when creating Vulkan surfaces
authorBenjamin Otte <otte@redhat.com>
Tue, 29 Nov 2016 13:47:59 +0000 (14:47 +0100)
committerBenjamin Otte <otte@redhat.com>
Fri, 9 Dec 2016 17:35:51 +0000 (18:35 +0100)
The Vulkan driver wants to operate on an X Window that it is sure does
exist.

gdk/x11/gdkvulkancontext-x11.c

index 71f27e3365a234d580d7358fd91b50fbdd3e8544..0d1038fd38afef3e1991628ee2191a055ed7d863 100644 (file)
@@ -39,6 +39,13 @@ gdk_x11_vulkan_context_create_surface (GdkVulkanContext *context,
   GdkWindow *window = gdk_draw_context_get_window (GDK_DRAW_CONTEXT (context));
   GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
 
+  /* This is necessary so that Vulkan sees the Window.
+   * Usually, vkCreateXlibSurfaceKHR() will not cause a problem to happen as
+   * it just creates resources, but futher calls with the resulting surface
+   * do cause issues.
+   */
+  gdk_display_sync (display);
+
   return GDK_VK_CHECK (vkCreateXlibSurfaceKHR, gdk_vulkan_context_get_instance (context),
                                                &(VkXlibSurfaceCreateInfoKHR) {
                                                    VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,